
<?php

  $id = !empty($_GET['id'])?$_GET['id']:''; //获取地址栏中参数名是id的值

  if(!empty($_POST)){

    $_POST['power'] = implode(',',$_POST['power']);
    // print_r($_POST);die;
    $_rows = edit('role',$id,$_POST);


    // 修改的条件要比其他功能多一个‘=’号
    if($_rows>=0){
       echo"<script>alert('角色修改成功');location.href='index.php?c=role&a=list&admin=1'</script>";die;
    }else{
       echo"<script>alert('角色修改失败');history.go(-1)</script>";die;
    }
  }

  $data = getSelectByOne('role',"id=$id");

  $data['power'] = explode(',',$data['power']);

  // 查找顶级数据
  $parent = getSelect('power','pid=0');
  // 查找子级数据
  $child = getSelect('power','pid!=0');


//加载后台公共视图
 include (View_PATH.$admin.'/communal.html');


?>

